package com.zxs.domain.model;

import com.zxs.Util.PaymentUtil;
import lombok.Data;

@Data
public class NotifyModel {
    private String merchantAcctId;
    private String version;
    private String language;
    private String signType;
    private String payType;
    private String bankId;
    private String orderId;
    private String orderTime;
    private String orderAmount;
    private String bindCard;
    private String bindMobile;
    private String dealId;
    private String bankDealId;
    private String dealTime;
    private String payAmount;
    private String fee;
    private String ext1;
    private String ext2;
    private String payResult;
    //private String aggregatePay;
    private String errCode;
    private String signMsg;

    // 验证签名
    public boolean checkSign() {
        // signMsg 签名字符串 不可空，生成加密签名串
        String signMsgVal = "";
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "merchantAcctId", merchantAcctId);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "version", version);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "language", language);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "signType", signType);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "payType", payType);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "bankId", bankId);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "orderId", orderId);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "orderTime", orderTime);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "orderAmount", orderAmount);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "bindCard", bindCard);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "bindMobile", bindMobile);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "dealId", dealId);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "bankDealId", bankDealId);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "dealTime", dealTime);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "payAmount", payAmount);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "fee", fee);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "ext1", ext1);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "ext2", ext2);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "payResult", payResult);
        //signMsgVal = PaymentUtil.appendParam(signMsgVal, "aggregatePay", aggregatePay);
        signMsgVal = PaymentUtil.appendParam(signMsgVal, "errCode", errCode);

        boolean result = PaymentUtil.enCodeByCer(signMsgVal, signMsg);
        return result;
    }

}
